<?php
    session_start();
    include_once '../../../../controlador/php/conexion/Conexion.php';
    $con = new Conexion();
    
    $reci = $_REQUEST['reci'];
    $oid = $_REQUEST['oid'];
    
   $count = "select count(*) as resp from lbseguimiento where hcnsolexa = ".$oid;
    $res = $con->query($count);
    
    while($res2 = mssql_fetch_array($res)){
      echo  $resp = $res2['resp'];
    }
    if ($resp == 0){
    
        $inser= "insert into lbseguimiento(hcnsolexa,segfecrec,segestado,segrecibido,usu_oid,usu_oidr)values('".$oid."',GETDATE(),'','1','','".$_SESSION['usuario']."')";
        $con->query($inser);
        
    }else if($resp == 1){
        $update = "update lbseguimiento
                        set segrecibido ='1',
                        segfecrec = GETDATE(),
                        usu_oidr ='".$_SESSION['usuario']."'
                   where hcnsolexa = '".$oid."'";
        $con->query($update);
    }
    $con->cerrarConexion();
    
 
?>